<?php 
	 
	if($upproduct->num_rows()>0){
		foreach($upproduct->result() as $rows){
?>
<div class="content-inner">
	<div class="marg20-btm">
           <a href=<?php echo site_url('backend_pages/allproducts'); ?> class="btn btn-primary">&hearts; View All Products </a>
     </div>
     
     <div>
     
      <a href="<?php echo site_url('backend_pages/sel_upateproduct/'.$this->uri->segment(3).'/chang_pro'); ?>">
					<?php
                    $image_properties = array(
                        'src' => 'assets/uploads/thumbs/thumb_' . $rows->pro_img,
                        'alt' => $rows->pro_name,
                        'class' => 'post_images',
                        'width' => '80',
                        'height' => '70',
                        'title' => 'Click to change image',
                        'rel' => 'lightbox',
						'style' => 'margin-left:159px; margin-bottom:10px; border: 1px solid; width:90px;'
                    );
                    echo img($image_properties);
                    ?>
                </a>
                <?php 
                if($this->uri->segment(4)=='chang_pro'){
				  echo '<div style="margin-left:159px; width:250px;">';
				   echo form_open_multipart('backend_pages/change_product');
				   $upload = array(
                  		'name' => 'userfile',
						'placeholder' => 'Product upload....',
						'value' => set_value('userfile'),
						'type' => 'file',
						'size' => '20'
              		);
				   $getoldimg = array(
                  		'name' => 'getoldimg',
						'type' => 'hidden',
						'value' => $rows->pro_img
              		);
				?>
                	
						<?php echo form_input($upload); ?><br />
<br />

                        <?php echo form_input($getoldimg); ?>
                        <div class="cleaner h10"></div>
                        <input type="submit" value="Change now" id="submit" name="btn_upload" class="btn btn-primary" />
                        <a href="<?php echo site_url('backend_pages/sel_upateproduct/'.$this->uri->segment(3)); ?>"><input type="button" value="Reset" id="reset" name="reset" class="btn" /></a>
                        
                        <?php
                            echo form_close();
                    }
                        ?>
             </div>
     
<form action=<?php echo site_url('backend_pages/sel_upateproduct'); ?> method="post" class="form-horizontal" enctype="multipart/form-data" />
<?php echo validation_errors(); 

			$pro_name = array(
                  'name' => 'pro_name',
                  'type' => 'text',
                  'placeholder' => 'Your products name...',
                  'required' => '',
                  'class' => 'input-xlarge',
                  'value' => $rows->pro_name
              );
			  $pro_id = array(
                  'name' => 'getpro_id',
                  'type' => 'hidden',
                  'value' => $rows->pro_id
              );
			  
			  $pro_img = array(
                  'name' => 'getimg',
                  'type' => 'hidden',
                  'value' => $rows->pro_img
              );
			  
			  
              $procate = array(
                  $rows->pro_cate_id => $rows->pro_cate_id,
				  '1' => 'Computer',
                  '2' => 'Phone'
                  
              );
              $protype = array(
                  $rows->pro_type => $rows->pro_type,
                  'new' => 'New',
                  'secondhand' => 'Second Hand'
              );
              $prostatu = array(
                  $rows->pro_statu_id => $rows->pro_statu_id,
                  '1' => 'Publish',
                  '0' => 'Unpublish'
              );
              $desc = array(
                  'name' => 'pro_desc',
                  'type' => 'textarea',
                  'placeholder' => 'Your description ...',
                  'cols' => '15',
                  'required' => '',
                  'rows' => '5',
                  'value' => $rows->pro_description
              );
              $proprice = array(
                  'name' => 'pro_price',
                  'type' => 'text',
                  'required' => '',
                  'class' => 'input-xlarge',
                  'value' => $rows->pro_price
              );
			  
			
			
			}
		}
		?>
    	
    
    
        
		<div class="control-group">
			<label class="control-label" for="input01">Products name<font color="red">*</font></label>
			<div class="controls">
				<?php echo form_input($pro_name); ?>
                <?php echo form_input($pro_id); ?>
              <?php echo form_input($pro_img); ?>
			</div>
		</div>
		
		<div class="control-group">
			<label class="control-label" for="input01">Category<font color="red">*</font> </label>
			<div class="controls">
				<?php echo form_dropdown('pro_cate',$procate); ?>
			</div>
		</div>
        <div class="control-group">
			<label class="control-label" for="input01">Type<font color="red">*</font> </label>
			<div class="controls">
				<?php echo form_dropdown('pro_type',$protype); ?>
			</div>
		</div>
        <div class="control-group">
			<label class="control-label" for="input01">Status<font color="red">*</font> </label>
			<div class="controls">
				<?php echo form_dropdown('pro_statu',$prostatu); ?>
			</div>
		</div>
        <div class="control-group">
			<label class="control-label" for="input01">Price<font color="red">*</font></label>
			<div class="controls">
				<?php echo form_input($proprice); ?>
			</div>
		</div>
       
        <div class="control-group">
			<label class="control-label" for="input01">Description<font color="red">*</font> </label>
			<div class="controls">
				<?php echo form_textarea($desc); ?>
			</div>
		</div>
		
		<div class="form-actions">
			<input type="submit" class="btn btn-primary" name="btn_upload" value="Change now" />
			<a href="<?php echo site_url('backend_pages/allproducts'); ?>" class="btn">Cancel </a>
		</div>
	<?php
	  	echo form_close();
	  ?>